# Disable implicit-fallthrough, if used.
append_if(CXX_SUPPORTS_IMPLICIT_FALLTHROUGH_FLAG "-Wno-implicit-fallthrough" CMAKE_CXX_FLAGS)

add_llbuild_library(llvmSupport STATIC
APFloat.cpp
APInt.cpp
APSInt.cpp
Allocator.cpp
Atomic.cpp
Chrono.cpp
CommandLine.cpp
ConvertUTF.cpp
ConvertUTFWrapper.cpp
DJB.cpp
Debug.cpp
Errno.cpp
Error.cpp
ErrorHandling.cpp
FileUtilities.cpp
FoldingSet.cpp
FormatVariadic.cpp
Hashing.cpp
Host.cpp
Locale.cpp
MD5.cpp
ManagedStatic.cpp
MathExtras.cpp
Memory.cpp
MemoryBuffer.cpp
Mutex.cpp
NativeFormatting.cpp
Options.cpp
Path.cpp
Process.cpp
Program.cpp
Signals.cpp
SmallPtrSet.cpp
SmallVector.cpp
SourceMgr.cpp
StringExtras.cpp
StringMap.cpp
StringRef.cpp
StringSaver.cpp
TargetParser.cpp
Threading.cpp
Triple.cpp
Twine.cpp
Unicode.cpp
UnicodeCaseFold.cpp
Valgrind.cpp
YAMLParser.cpp
circular_raw_ostream.cpp
raw_ostream.cpp
  )


target_link_libraries(llvmSupport PRIVATE
  llvmDemangle
  Threads::Threads
  ${CMAKE_DL_LIBS})

if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|OpenBSD")
  target_link_libraries(llvmSupport PRIVATE
    execinfo)
endif()

if(${CMAKE_SYSTEM_NAME} MATCHES "Android|Darwin|Linux|FreeBSD")
  target_link_libraries(llvmSupport PRIVATE curses)
endif()

set_property(GLOBAL APPEND PROPERTY LLBuild_EXPORTS llvmSupport)
